package test.designpattern.simpleFactory;

import java.util.Scanner;

public class Calculator1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入数字A：");
        double a = sc.nextDouble();
        System.out.print("请选择运算符号（+、-、*、/）：");
        String symbol = sc.next();
        System.out.print("请输入数字B：");
        double b = sc.nextDouble();
        double result = 0d;
        switch (symbol) {
            case "+":
                result = a + b;
                break;
            case "-":
                result = a - b;
                break;
            case "*":
                result = a * b;
                break;
            case "/":
                result = a / b;
                break;
        }
        System.out.println("A " + symbol + " B = " + result);

    }
}
